package ontime

import (
	"time"
)

type Job func() error
type Entry struct {
	EntryId  int64
	ExpireAt time.Time
	Job      Job
	//unique tag, if not empty, we can use it to remove duplicate entries,not only by EntryId
	UniqueTag string
}

type EntryChain []*Entry

func (e EntryChain) Swap(i, j int)      { e[i], e[j] = e[j], e[i] }
func (e EntryChain) Len() int           { return len(e) }
func (e EntryChain) Less(i, j int) bool { return e[i].ExpireAt.Before(e[j].ExpireAt) }
